Skip to content

test: WPT for Wasm jsapi including new ESM Integration tests#59034

Open
guybedford wants to merge 10 commits intonodejs:mainfrom
guybedford:wpt-wasm-jsapi
Open

test: WPT for Wasm jsapi including new ESM Integration tests#59034
guybedford wants to merge 10 commits intonodejs:mainfrom
guybedford:wpt-wasm-jsapi

Conversation

@guybedford
Copy link
Contributor

This adds the jsapi test suite for WebAssembly including the new ESM Integration jsapi tests from WebAssembly/esm-integration#110 with upstream PR in web-platform-tests/wpt#53718.

Tests for string builtins and namespaceInstance are pending #59020 and #59024 respectively.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/web-standards

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Jul 11, 2025
@codecov
Copy link

codecov bot commented Jul 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.68%. Comparing base (a936d89) to head (643faf0).
⚠️ Report is 68 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #59034      +/-   ##
==========================================
+ Coverage   89.67%   89.68%   +0.01%     
==========================================
  Files         676      676              
  Lines      206501   206738     +237     
  Branches    39540    39600      +60     
==========================================
+ Hits       185177   185412     +235     
- Misses      13457    13463       +6     
+ Partials     7867     7863       -4     

see 59 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@legendecas legendecas added the commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label Mar 23, 2026
@panva
Copy link
Member

panva commented Mar 23, 2026

out/Release/node --experimental-wasm-modules /repo/node/test/wpt/test-wasm-jsapi.mjs
(node:83231) Warning: Failed to load the ES module: /repo/node/test/fixtures/es-modules/globals.js. Make sure to set "type": "module" in the nearest package.json file or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
node:internal/modules/run_main:107
    triggerUncaughtException(
    ^

AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

  ok(e instanceof WebAssembly.CompileError)

    at file:///repo/node/test/wpt/test-wasm-jsapi.mjs:13:3 {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '==',
  diff: 'simple'
}
/repo/node/test/fixtures/es-modules/globals.js:5
export { i32_value as '🚀i32_value' }
^^^^^^

SyntaxError: Unexpected token 'export'
    at wrapSafe (node:internal/modules/cjs/loader:1762:18)
    at Module._compile (node:internal/modules/cjs/loader:1803:20)
    at Module._extensions..js (node:internal/modules/cjs/loader:1969:10)
    at Module.load (node:internal/modules/cjs/loader:1552:32)
    at Module._load (node:internal/modules/cjs/loader:1354:12)
    at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
    at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:325:3)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:230:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:430:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:639:26)

@nodejs-github-bot
Copy link
Collaborator

@richardlau
Copy link
Member

@miladfarca FYI it looks like some of these tests are failing on Linux s390x.

@guybedford
Copy link
Contributor Author

So, it seems it this is for round-tripping v128:

  [UNEXPECTED_FAILURE][FAIL] v128 globals should work correctly in WebAssembly-to-WebAssembly imports
  assert_equals: expected 1 but got 67108864
      at Test.<anonymous> (/home/iojs/build/workspace/node-test-commit-linuxone/test/fixtures/wpt/wasm/jsapi/esm-integration/mutable-global-sharing.tentative.any.js:52:3)
      at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
  Command: /home/iojs/build/workspace/node-test-commit-linuxone/out/Release/node --experimental-wasm-modules undefined 'esm-integration/mutable-global-sharing.tentative.any.js'

The value returned is consistent with big endian handling of the SIMD path, which formally speaking is a V8 bug since Wasm is supposed to have little endian behaviours.

There is a SIMD test for this in V8, but V8 only runs x390x simulator assuming VECTOR_ENHANCE_FACILITY_2, which might not be available on our hardware?

I've pushed a temporary commit which replicates the internal simd test suite case in question, to see if that also fails on the hardware. If so, then this is a V8 bug on s390x separate to the WPT work here.

@nodejs-github-bot
Copy link
Collaborator

@guybedford
Copy link
Contributor Author

I can confirm the same failure, so this is a v8 bug for Wasm SIMD on s390x - https://ci.nodejs.org/job/node-test-commit-aix/61569/nodes=aix72-power9/testReport/junit/(root)/parallel/test_wasm_simd_global/.

I've added a specific skip for this environment to resolve the issue, given this is not a Node.js or WPT issue.

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@richardlau
Copy link
Member

I can confirm the same failure, so this is a v8 bug for Wasm SIMD on s390x - https://ci.nodejs.org/job/node-test-commit-aix/61569/nodes=aix72-power9/testReport/junit/(root)/parallel/test_wasm_simd_global/.

FWIW AIX is not Linux s390x, but both are big endian platforms.

@miladfarca
Copy link
Contributor

This patch should fix the issue on big endian (which includes s390x): http://crrev.com/c/7704213

hubot pushed a commit to v8/v8 that referenced this pull request Mar 26, 2026
Since http://crrev.com/c/2944437 globals are no longer little endian
enforced.

S128Const handling in the initializer needs to take this into account
and byte reverse values which are hard coded in little endian order.

This is currently causing failures on Node.js upstream:
nodejs/node#59034 (comment)

Change-Id: Ifcc9ade93ee51565ab19b16e9dadf0ff5752f7a6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7704213
Commit-Queue: Milad Farazmand <mfarazma@ibm.com>
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#106082}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants